prime number python algorithm